package com.chinamobile.iot.handler.model;

import java.util.Date;

/**
 * Created by szl on 2017/7/10.
 */
public class BrokerInfo {

    public final static String NORMAL = "ok";
    public final static String ABNORMAL = "nok";

    private String name;
    /**
     * broker内网的IP地址
     */
    private String ip;
    /**
     * broker内网的端口号
     */
    private int port;
    /**
     * broker启动时间
     */
    private Date startTime;

    /**
     * 当前broker的状态, ok, maintain
     */
    private String status = NORMAL;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        BrokerInfo that = (BrokerInfo) o;

        if (port != that.port) return false;
        if (!name.equals(that.name)) return false;
        return ip.equals(that.ip);
    }

    @Override
    public int hashCode() {
        int result = name.hashCode();
        result = 31 * result + ip.hashCode();
        result = 31 * result + port;
        return result;
    }
}
